import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { BuildingRoomForm, BuildingRoomQuery, BuildingRoomVO } from '@/api/system/buildingRoom/types';

/**
 * 查询房屋管理列表
 * @param query
 * @returns {*}
 */

export const listBuildingRoom = (query?: BuildingRoomQuery): AxiosPromise<BuildingRoomVO[]> => {
  return request({
    url: '/system/buildingRoom/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询房屋管理详细
 * @param roomId
 */
export const getBuildingRoom = (roomId: string | number): AxiosPromise<BuildingRoomVO> => {
  return request({
    url: '/system/buildingRoom/' + roomId,
    method: 'get'
  });
};

/**
 * 新增房屋管理
 * @param data
 */
export const addBuildingRoom = (data: BuildingRoomForm) => {
  return request({
    url: '/system/buildingRoom',
    method: 'post',
    data: data
  });
};

/**
 * 修改房屋管理
 * @param data
 */
export const updateBuildingRoom = (data: BuildingRoomForm) => {
  return request({
    url: '/system/buildingRoom',
    method: 'put',
    data: data
  });
};

/**
 * 删除房屋管理
 * @param roomId
 */
export const delBuildingRoom = (roomId: string | number | Array<string | number>) => {
  return request({
    url: '/system/buildingRoom/' + roomId,
    method: 'delete'
  });
};
